package com.blockchain.front.servlets.trading;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.blockchain.framework.service.ServiceSession;
import com.blockchain.front.service.trading.TradingManage;
import com.blockchain.util.parser.IntegerParser;

public class OrdinaryJson extends AbstractTradingServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void processPost(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		long time = IntegerParser.parse(request.getParameter("time"));
		long market = IntegerParser.parse(request.getParameter("market"));
		TradingManage tradingManage = serviceSession.getService(TradingManage.class);
		String data = tradingManage.getOrdinaryList(market, time);
		response.getWriter().write(data);
	}

	@Override
	protected void processGet(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		processPost(request, response, serviceSession);
	}

}
